<?php /* SVN: $Id: $ */ ?>
<div class="projectFlags index js-response">
<div class="page-count-block clearfix">
		<div class="grid_left">
			<?php echo $this->element('paging_counter'); ?>
		</div>
</div>
<div class="form-outer-block clearfix">
<?php
 echo $this->Form->create('ProjectFlag' , array('class' => 'normal clearfix','action' => 'update')); ?>
<?php echo $this->Form->input('r', array('type' => 'hidden', 'value' => $this->request->url)); ?>
<table class="list">
    <tr>
    	<th class="select"></th>
        <th class="actions"><?php echo __l('Action');?></th>
        <th><div class="js-pagination"><?php echo $this->Paginator->sort(__l('User'), 'User.username');?></div></th>
        <th class="dl"><div class="js-pagination"><?php echo $this->Paginator->sort(__l('Project'), 'Project.name');?></div></th>
        <th><div class="js-pagination"><?php echo $this->Paginator->sort(__l('Flag Category'), 'ProjectFlagCategory.name');?></div></th>
        <th class="dl"><div class="js-pagination"><?php echo $this->Paginator->sort(__l('Message'),'message');?></div></th>
        <th><div class="js-pagination"><?php echo $this->Paginator->sort(__l('IP'), 'Ip.ip');?></div></th>
    </tr>

<?php
if (!empty($projectFlags)):

$i = 0;
foreach ($projectFlags as $projectFlag):
	$class = null;
	if ($i++ % 2 == 0) {
		$class = ' class="altrow"';
	}
?>
	<tr<?php echo $class;?>>
	   <td><?php echo $this->Form->input('ProjectFlag.'.$projectFlag['ProjectFlag']['id'].'.id', array('type' => 'checkbox', 'id' => "admin_checkbox_".$projectFlag['ProjectFlag']['id'], 'label' => false, 'class' => 'js-checkbox-list')); ?></td>
		<td class="actions">
		 <div class="action-block">
		<span class="action-information-block">
                            <span class="action-left-block">&nbsp;&nbsp;</span>
                                <span class="action-center-block">
                                    <span class="action-info">
                                        Action                                     </span>
                                </span>
                            </span>
							<div class="action-inner-block">
                            <div class="action-inner-left-block">
							<ul class="action-link clearfix">
						

		<li><span><?php echo $this->Html->link(__l('Delete'), array('action' => 'delete', $projectFlag['ProjectFlag']['id']), array('class' => 'delete js-delete', 'title' => __l('Delete')));?></span></li>
		</ul>
		</div>
			 <div class="action-bottom-block"></div>
			 </div>
			 </div>
		
		</td>
		<td><?php echo $this->Html->link($this->Html->cText($projectFlag['User']['username']), array('controller'=> 'users', 'action'=>'view', $projectFlag['User']['username'], 'admin' => false),array('escape' => false,'title'=>$this->Html->cText($projectFlag['User']['username'],false)));?></td>
		<td class="dl">
		
		 <span title="<?php echo $projectFlag['Project']['ProjectStatus']['name']; ?>" class="<?php echo 'project-status-info project-status-'.strtolower(str_replace(" ","",$projectFlag['Project']['ProjectStatus']['name']));?>">
		<?php echo $this->Html->cText($projectFlag['Project']['ProjectStatus']['name']); ?></span>

		<?php echo $this->Html->link($this->Html->cText($projectFlag['Project']['name']), array('controller'=> 'projects', 'action'=>'view', $projectFlag['Project']['slug'], 'admin' => false),array('escape' => false,'title'=>$this->Html->cText($projectFlag['Project']['name'],false)));?>
        </td>
		<td><?php echo $this->Html->cText($projectFlag['ProjectFlagCategory']['name']); ?></td>
		<td class="dl"><?php echo $this->Html->cText($projectFlag['ProjectFlag']['message']);?></td>
		 <td class="dl">
                        <?php if(!empty($projectFlag['Ip']['ip'])): ?>							  
                            <?php echo  $this->Html->link($projectFlag['Ip']['ip'], array('controller' => 'users', 'action' => 'whois', $projectFlag['Ip']['ip'], 'admin' => false), array('target' => '_blank', 'title' => 'whois '.$this->Html->cText($projectFlag['Ip']['host'],false), 'escape' => false)); ?> 
							<p>
							<?php 					
                            if(!empty($projectFlag['Ip']['Country'])):
                                ?>
                                <span class="flags flag-<?php echo strtolower($projectFlag['Ip']['Country']['iso2']); ?>" title ="<?php echo $projectFlag['Ip']['Country']['name']; ?>">
									<?php echo $projectFlag['Ip']['Country']['name']; ?>
								</span>
                                <?php
                            endif; 
							 if(!empty($projectFlag['Ip']['City'])):
                            ?>             
                            <span> 	<?php echo $projectFlag['Ip']['City']['name']; ?>    </span>
                            <?php endif; ?>
                            </p>
                        <?php else: ?>
							<?php echo __l('N/A'); ?>
						<?php endif; ?>    
		</td>
        </tr>
<?php
    endforeach;
else:
?>
	<tr>
		<td colspan="10" class="notice"><?php echo __l('No ProjectFlags available');?></td>
	</tr>
<?php
endif;
?>
</table>

<?php
if (!empty($projectFlag)) { ?>
<div class="clearfix">
	<div class="admin-select-block grid_left">
	<div class="select-options">
		<?php echo __l('Select:'); ?>
		<?php echo $this->Html->link(__l('All'), '#', array('class' => 'js-admin-select-all', 'title' => __l('All'))); ?>
		<?php echo $this->Html->link(__l('None'), '#', array('class' => 'js-admin-select-none', 'title' => __l('None'))); ?>
	</div>
	<div class="admin-checkbox-button"> <?php echo $this->Form->input('more_action_id', array('class' => 'js-admin-index-autosubmit', 'label' => false, 'empty' => __l('-- More actions --'))); ?> </div>
	</div>
		<div class="js-pagination grid_right">
        <?php echo $this->element('paging_links'); ?>
    </div>
	 </div>
<?php
}
?>
<?php echo $this->Form->end(); ?>
</div>
</div>
